<%--
  Created by IntelliJ IDEA.
  User: zjl
  Date: 2019/11/28
  Time: 17:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<%
    pageContext.setAttribute("APP_PATH",request.getContextPath());
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript" src="${APP_PATH}/static/js/jquery-2.1.4.min.js"></script>
<link href="${APP_PATH}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<script src="${APP_PATH}/static/js/bootstrap.min.js"></script>
<body>
    <%--搭建显示页面--%>
    <div class="container">
        <%--标题--%>
        <div class="row">
            <div class="col-md-12">
                <h2>SSM_CURD</h2>
            </div>
        </div>
            <%--按钮--%>
        <div class="row">
            <div class="col-md-4 col-md-offset-8">
                <button class="btn btn-primary">新增</button>
                <button class="btn btn-danger">删除</button>
            </div>
        </div>
            <%--数据--%>
        <div class="row">
            <div class="col-md-12">
                <table class="table table-bordered">
                    <tr>
                        <th>#</th>
                        <th>empName</th>
                        <th>gender</th>
                        <th>email</th>
                        <th>deptName</th>
                        <th>操作</th>
                    </tr>
                    <c:forEach items="${ pageInfo.list}" var="emp">
                        <tr>
                            <td>${emp.empId}</td>
                            <td>${emp.empName}</td>
                            <td>${emp.gender==M ?"男":"女"}</td>
                            <td>${emp.email}</td>
                            <td>${emp.deptName}</td>
                            <td>
                                <button class="btn btn-primary">编辑</button>
                                <button class="btn btn-danger">删除</button>
                            </td>

                        </tr>
                    </c:forEach>
                </table>
            </div>


        </div>
            <%--分页--%>
            <div class="row">
                <%----%>
                <div class="col-md-6">
                    当前${ pageInfo.pageNum }页，总${ pageInfo.pages}，总${pageInfo.total}条记录
                </div>
                <%----%>
                <div class="col-md-6">
                    <ul class="pagination">

                        <li><a href="${APP_PATH}/emps?pn=1" aria-label="Next">首页</a></li>

                        <c:if test="${pageInfo.hasPreviousPage}">
                            <li>
                                <a href="${APP_PATH}/emps?pn=${pageInfo.pageNum-1}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <c:forEach items="${pageInfo.navigatepageNums}" var="page_num">
                        <c:if test="${page_num == pageInfo.pageNum}">
                            <li class="active"><a href="#">${page_num}</a></li>
                        </c:if>
                            <c:if test="${page_num != pageInfo.pageNum}">
                                <li class="active"><a href="${APP_PATH}/emps?pn=${page_num}">${page_num}</a></li>
                            </c:if>
                        </c:forEach>
                        <c:if test="${pageInfo.hasNextPage}">
                            <li>
                                <a href="${APP_PATH}/emps/pn=${pageInfo.pageNum+1}" aria-label="Previous">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:if>

                        <li><a href="${APP_PATH}/emps?pn=${pageInfo.pages}" aria-label="Next">尾页</a></li>
                    </ul>
                </div>

            </div>

    </div>

</body>
</html>
